#ifndef TCPCONNECTION_HPP_
#define TCPCONNECTION_HPP_

#include <cstdint>
#include <cstdio>
#include <cerrno>
#include <cstdlib>
#include <string>
#include <sstream>
#include <iostream>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <netinet/tcp.h>

class TCPConnection{

private:

	int sock;
	struct sockaddr *socketaddr;
	bool connected;
	bool ipv6;

	int sendFlags;
	int recvFlags;

public:

	TCPConnection(bool ipv6, int socket, struct sockaddr *socketaddr);
	~TCPConnection();


	int sendData(void *data, size_t len);
	int receiveData(void *data, size_t len);

	void getHostname(std::string &hostname);

	bool isConnected();
	void closeConnection();

	void setSendFlags(int sendFlags);
	int getSendFlags();

	void setRecvFlags(int recvFlags);
	int getRecvFlags();

};


#endif /* TCPCONNECTION_HPP_ */
